local hj_qingzhuang = fk.CreateSkill {
  name = "hj_qingzhuang",
  tags = { Skill.Compulsory, },
}

local WU = require "packages/wdtx/WUltiity"

hj_qingzhuang:addEffect(fk.EventPhaseStart, {
  anim_type = "support",
  can_trigger = function(self, event, target, player, data)
    return player:hasSkill(hj_qingzhuang.name) and target == player and player.phase == Player.Play and
    player:usedSkillTimes(hj_qingzhuang.name, Player.HistoryTurn) == 0 and
    table.find(player:getCardIds("he"), function(cid) return Fk:getCardById(cid).type == Card.TypeEquip end)
  end,
  on_use = function(self, event, target, player, data)
    local room = player.room
    local equips = table.filter(player:getCardIds("he"), function(cid) return Fk:getCardById(cid).type == Card.TypeEquip end)
    local discs = math.ceil(#equips * 1.5)
    room:throwCard(equips, hj_qingzhuang.name, player, player)
    WU:checkCards(player, ".|.|.|.|.|^equip", discs)
  end,
})

return hj_qingzhuang
